package org.jeecg.modules.payment.enums;

import org.jeecg.common.annotation.EnumDict;
import org.jeecg.common.enums.IEnumDict;
import org.jeecg.common.exception.JeecgBootException;

@EnumDict(code ="pay_status_enums", name = "支付状态")
public enum PayStatusEnums implements IEnumDict<PayStatusEnums> {
    PAID("1", "已支付", "pay.status.paid"),

    UNPAID("0", "未支付", "pay.status.unpaid"),

    CANCELLED("2", "取消支付", "pay.status.cancelled");

    private String value;

    private String label;
    /**
     * 不一定要有，为了前端vue渲染有个key
     */
    private String key;

    PayStatusEnums(String value, String label, String key) {
        this.value = value;
        this.label = label;
        this.key = key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getRemark() {
        return null;
    }

    public static PayStatusEnums getEnumByValue(String value){
        for(PayStatusEnums item: values()){
            if(value.equals(item.value)){
                return item;
            }
        }
        throw new JeecgBootException("没找到对应字典");
    }

}
